package org.fas.display
{
	import flash.display.DisplayObjectContainer;
	import flash.display.Sprite;
	import flash.events.Event;
	
	import org.fas.utils.FuDisplayer;
	
	public class FSprite extends Sprite
	{
		public function FSprite(_x:int=0,_y:int=0,_container:DisplayObjectContainer=null)
		{
			super();
			if(_container){
				_container.addChild(this);
			}
			this.move(_x,_y);
			this.addEventListener(Event.ADDED_TO_STAGE,evtAddedStage);
		}
		public function move(_x:int,_y:int):void{
			this.x = _x;
			this.y = _y;
		}
		public function set scale(_v:Number):void{
			this.scaleX = _v;
			this.scaleY = _v;
		}
		public function get scale():Number{
			return this.scaleX;
		}
		protected function evtAddedStage(_e:Event):void{
			this.addEventListener(Event.REMOVED_FROM_STAGE,evtRemovedStage);
		}
		protected function evtRemovedStage(_e:Event):void{
			this.removeEventListener(Event.REMOVED_FROM_STAGE,evtRemovedStage);
		}
		/**
		 *destruct self 
		 * 
		 */
		public function destruct():void{
			FuDisplayer.removeSelf(this);
			this.removeEventListener(Event.ADDED_TO_STAGE,evtRemovedStage);
		}
	}
}